/**
 * 
 */
package idv.takeshi.software.productline.bookstore.utils.text;

import org.apache.commons.lang.Validate;

/**
 * A utility class for striping tags.
 * @author takeshi
 *
 */
public class StripTagUtils {
	
	private StripTagUtils(){}
	
	/**
	 * Strip all tags in the given text, and replace all special chars into one space char.
	 * @param text
	 * @return
	 */
	public static String stripTags(String text){
		Validate.notEmpty(text, "text shall always not be null/empty");
		String newText = null;
		newText = text.replaceAll("\\<.*?\\>", "");
		newText = newText.replaceAll("-->", "");
		newText = newText.replaceAll("\\s+", " ");
		return newText;
	}
	
}
